package com.sitech.ibnms.c3p.task;

import com.sitech.ibnms.c3p.service.C3pTaskFlowService;
import com.sitech.ibnms.c3p.task.notice.ExecutePolicy;
import com.sitech.ismp.workflow.domain.Task;

import java.util.Map;

/**
 * Created by leo on 15/6/17.
 */
public interface C3pTaskFlowServiceExtends extends C3pTaskFlowService {
    /**
     * 启动子任务流程
     *
     * @param c3pTaskId C3P 任务ID
     * @param userId
     * @param context   存储父实例号，父环节号，调度ID等
     */
    int startTask(String c3pTaskId, String userId, String title, Map<Integer, ExecutePolicy> executeParam, Map<String, String> context);

    /**
     * 开始环节
     *
     * @param taskId
     * @param userId
     * @param title
     */
    void startNode(int taskId, String userId, String title);

    /**
     * 异步启动子任务流程
     *
     * @param c3pTaskId
     * @param userId
     * @param title
     * @param context
     * @return
     */
    int startTask(String c3pTaskId, String userId, String title, Map<String, String> context);

    /**
     * 提交环节
     *
     * @param taskId
     * @param userId
     * @param title
     */
    void submitNode(int taskId, String userId, String title);

    void failPolicy(Task task, Throwable throwable);
}
